import React from 'react';
import '@radix-ui/themes/styles.css';
import { Theme } from '@radix-ui/themes';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { HelmetProvider } from 'react-helmet-async';
import { Helmet } from 'react-helmet-async';

import Home from './src/pages/Home.jsx';
import NotFound from './src/pages/NotFound.jsx';

    export default function App() {
  return (
    <HelmetProvider>
      <Theme appearance="inherit" radius="large" scaling="100%">
        <Router>
          <Helmet>
            {/* 基础SEO设置 */}
            <html lang="zh-CN" />
            <meta name="robots" content="index, follow" />
            <meta name="googlebot" content="index, follow" />
            <meta name="baiduspider" content="index, follow" />
            
            {/* 网站图标 */}
            <link rel="icon" href="https://meku.dev/favicon.ico" />
            <link rel="apple-touch-icon" href="https://meku.dev/apple-touch-icon.png" />
            
            {/* DNS预解析 */}
            <link rel="dns-prefetch" href="//fonts.googleapis.com" />
            <link rel="dns-prefetch" href="//fonts.gstatic.com" />
            <link rel="dns-prefetch" href="//www.google-analytics.com" />
            <link rel="dns-prefetch" href="//www.googletagmanager.com" />
          </Helmet>
          
          <main className="min-h-screen bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-50">
            <Routes>
              <Route path="/" element={<Home />} />
              <Route path="*" element={<NotFound />} />
            </Routes>
            <ToastContainer
              position="top-right"
              autoClose={3000}
              newestOnTop
              closeOnClick
              pauseOnHover
              theme="light"
            />
          </main>
        </Router>
      </Theme>
    </HelmetProvider>
  );
}